#ifndef _VL_H
#define _VL_H

#define BUF (0x64)
#define DEBUG 2

struct rule {
	uint8_t upper_ch;
	uint8_t reg[BUF];
};

struct mean {
	uint8_t lower_ch;
	uint8_t meaning[BUF];
};

struct stack {
	uint8_t ch;
	struct stack *next;
};

static inline int init(struct stack *s)								
{									
	s->next = NULL;							
}

static inline int push(struct stack *s, int x)								
{									
	struct stack *build = NULL;				

	build = (struct stack *)malloc(sizeof(struct stack));		
	if (!build) {							
		fprintf(stderr, "Allocate Error!\n");			
		return 1;						
	}								
	build->ch = x;							
	build->next = s->next;	
	s->next = build;
	return 0;
}

static inline int pop(struct stack *s, char *x)								
{
	struct stack *follow = NULL;					

	follow = s->next;						
/*	if (!follow) {							
		fprintf(stdout, "Stack Empty!\n");			
		return 1;						
	} */								
	s->next = follow->next;						
	*x = follow->ch;						
	free(follow);							
	return 0;							
}

extern int take_bracket(char *vol_lan);
extern int record(char *vol_lan, struct mean *implication, int i_counter);
extern int replace_uppers(char *vol_lan, struct rule *regu, int r_counter);
extern int tran_vol(char *vol_lan, struct rule *regu, int r_counter);
extern int rd_file(char *r_file, char *i_file, struct rule **regu, 
		struct mean **implication, int *r_counter, int *i_counter);
#endif
